﻿module VirtualCity.Setup.Items

open Casanova
open Casanova.Utilities
open Casanova.Core
open Casanova.Coroutines
open Casanova.Game
open Casanova.Input
open Casanova.Math
open Casanova.Drawing
open VirtualCity
open VirtualCity.Scripts
open VirtualCity.Initialization
open VirtualCity.World
open VirtualCity.CityDescription
open VirtualCity.City
open VirtualCity.Rendering
open Casanova.StandardLibrary.Core
open Casanova.StandardLibrary.Physics

open VirtualCity.PlanDescription


let sofa_home = 
  let use_effects = 
    [
      UseEffects.Create("Take nap", Stats<_>.OneRested * 0.05f, Stats<_>.OneSated * 0.05f, 3600.0f<s>)
      UseEffects.Create("Sleep", Stats<_>.OneRested * 0.35f, Stats<_>.OneSated * 0.05f, 14400.0f<s>)
    ]
  {
    ItemDescription.Name  = "Sofa"
    UseEffects      = use_effects
    UseSlots        = UseSlot.AllDay
    OpenUse         = false
  }
let bed = 
  let use_effects = 
    [
      UseEffects.Create("Deep sleep", Stats<_>.OneRested * 1.0f, Stats<_>.OneSated * 0.2f, 28800.0f<s>)
    ]
  {
    ItemDescription.Name  = "Bed"
    UseEffects      = use_effects
    UseSlots        = UseSlot.HourRange(17,10)
    OpenUse         = false
  }
let kitchen = 
  let use_effects = 
    [
      UseEffects.Create("Cook and eat", Stats<_>.OneSated * 0.8f + Stats<_>.OneEnjoyed * 0.2f, Stats<_>.OneRested * 0.05f, [for i = 1 to 3 do yield "Groceries"], 3600.0f<s>)
      UseEffects.Create("Have snack", Stats<_>.OneSated * 0.1f, Stats.Zero, ["Groceries"], 1200.0f<s>)
    ]
  {
    ItemDescription.Name  = "Kitchen"
    UseEffects      = use_effects
    UseSlots        = UseSlot.AllDay
    OpenUse         = false
  }
let tv = 
  let use_effects = UseEffects.Create("Watch TV", Stats<_>.OneRelaxed * 0.3f + Stats<_>.OneEnjoyed * 0.6f, 
                                      Stats<_>.OneRested * 0.01f + Stats<_>.OneFit * 0.1f + Stats<_>.OneSated * 0.1f, [], 3600.0f<s>)
  {
    ItemDescription.Name  = "Television"
    UseEffects      = [use_effects]
    UseSlots        = UseSlot.AllDay
    OpenUse         = false
  }

let work_desk = 
  let use_effects = 
    {
      UseEffects.Create("Work", Stats.Zero, 
                        Stats<_>.OneRested * 0.2f + Stats<_>.OneFit * 0.004f + Stats<_>.OneEnjoyed * 0.01f +
                        Stats<_>.OneSated * 0.04f + Stats<_>.OneRelaxed * 0.2f, 14400.0f<s>)
      with MoneyGained = 45.0f<eur>
    }
  {
    ItemDescription.Name  = "Desk"
    UseEffects      = [use_effects]
    UseSlots        = UseSlot.HourRange(8,17)
    OpenUse         = false
  }
let vending_machine = 
  let use_effects = 
    {
      UseEffects.Create("Drink coffee", Stats<_>.OneSated * 0.05f + Stats<_>.OneRelaxed * 0.01f, 
                        Stats<_>.OneRested * 0.01f + Stats<_>.OneFit * 0.01f, 1200.0f<s>)
        with MoneyLost = 5.0f<eur>
    }
  {
    ItemDescription.Name  = "Coffee pot"
    UseEffects      = [use_effects]
    UseSlots        = UseSlot.HourRange(8,17)
    OpenUse         = false
  }
let sofa_work = 
  let use_effects = UseEffects.Create("Relax", Stats<_>.OneRelaxed * 0.01f + Stats<_>.OneRested * 0.01f, 
                                      Stats<_>.OneFit * 0.01f + Stats<_>.OneSated * 0.05f, [], 1200.0f<s>)
  {
    ItemDescription.Name  = "Sofa"
    UseEffects      = [use_effects]
    UseSlots        = UseSlot.HourRange(8,17)
    OpenUse         = false
  }

let resturant_table = 
  let use_effects = 
    {
      UseEffects.Create("Eat out", Stats<_>.OneSated * 0.6f + Stats<_>.OneEnjoyed * 0.4f,
                        Stats<_>.OneRested * 0.01f + Stats<_>.OneFit * 0.1f, 3600.0f<s>)
        with MoneyLost = 35.0f<eur>
    }
  {
    ItemDescription.Name  = "Table"
    UseEffects      = [use_effects]
    UseSlots        = UseSlot.HourRange(12,22)
    OpenUse         = true
  }
let restaurant_kitchen = 
  let use_effects = 
    {
      UseEffects.Create("Cook", Stats.Zero,
                        Stats<_>.OneRested * 0.2f + Stats<_>.OneFit * 0.004f + Stats<_>.OneEnjoyed * 0.2f +
                        Stats<_>.OneSated * 0.04f + Stats<_>.OneRelaxed * 0.2f, 14400.0f<s>)
      with MoneyGained = 55.0f<eur>
    }
  {
    ItemDescription.Name  = "Kitchen"
    UseEffects      = [use_effects]
    UseSlots        = UseSlot.HourRange(11,23)
    OpenUse         = false
  }
let fastfood_table = 
  let use_effects = 
    {
      UseEffects.Create("Have fastfood", Stats<_>.OneSated * 0.7f + Stats<_>.OneEnjoyed * 0.5f,
                        Stats<_>.OneRested * 0.01f + Stats<_>.OneFit * 0.2f, 2400.0f<s>)
        with MoneyLost = 15.0f<eur>
    }
  {
    ItemDescription.Name  = "Fastfood table"
    UseEffects      = [use_effects]
    UseSlots        = UseSlot.HourRange(7,22)
    OpenUse         = true
  }
let fastfood_kitchen = 
  let use_effects = 
    {
      UseEffects.Create("Cook", Stats.Zero,
                        Stats<_>.OneRested * 0.2f + Stats<_>.OneFit * 0.004f + Stats<_>.OneEnjoyed * 0.1f +
                        Stats<_>.OneSated * 0.04f + Stats<_>.OneRelaxed * 0.2f, 14400.0f<s>)
      with MoneyGained = 35.0f<eur>
    }
  {
    ItemDescription.Name  = "Kitchen"
    UseEffects      = [use_effects]
    UseSlots        = UseSlot.HourRange(6,23)
    OpenUse         = false
  }

let trail = 
  let use_effects = 
    [
      UseEffects.Create("Walk", Stats<_>.OneEnjoyed * 0.3f + Stats<_>.OneFit * 0.2f + Stats<_>.OneRelaxed * 0.05f,
                        Stats<_>.OneRested * 0.05f + Stats<_>.OneSated * 0.1f, 3600.0f<s>)
      UseEffects.Create("Jog", Stats<_>.OneEnjoyed * 0.1f + Stats<_>.OneFit * 0.4f + Stats<_>.OneRelaxed * 0.1f,
                        Stats<_>.OneRested * 0.05f + Stats<_>.OneSated * 0.2f, 3600.0f<s>)
    ]
  {
    ItemDescription.Name  = "Woods trail"
    UseEffects      = use_effects
    UseSlots        = UseSlot.HourRange(5,21)
    OpenUse         = true
  }

let smallpark = 
  let use_effects = 
    [
      UseEffects.Create("Walk", Stats<_>.OneEnjoyed * 0.15f + Stats<_>.OneFit * 0.1f + Stats<_>.OneRelaxed * 0.025f,
                        Stats<_>.OneRested * 0.05f + Stats<_>.OneSated * 0.1f, 1800.0f<s>)
      UseEffects.Create("Jog", Stats<_>.OneEnjoyed * 0.05f + Stats<_>.OneFit * 0.2f + Stats<_>.OneRelaxed * 0.05f,
                        Stats<_>.OneRested * 0.05f + Stats<_>.OneSated * 0.2f, 1800.0f<s>)
    ]
  {
    ItemDescription.Name  = "Visit to the Park"
    UseEffects      = use_effects
    UseSlots        = UseSlot.HourRange(5,21)
    OpenUse         = true
  }

let exercise_machine = 
  let use_effects = 
    {
      UseEffects.Create("Exercise", Stats<_>.OneFit * 0.4f + Stats<_>.OneRelaxed * 0.1f,
                        Stats<_>.OneRested * 0.05f + Stats<_>.OneSated * 0.2f, 3600.0f<s>)
      with MoneyLost = 5.0f<eur>
    }
  {
    ItemDescription.Name  = "Treadmill"
    UseEffects      = [use_effects]
    UseSlots        = UseSlot.HourRange(06,10) @ UseSlot.HourRange(17,23)
    OpenUse         = true
  }

let big_screen = 
  let use_effects = 
    {
      UseEffects.Create("Watch movie", Stats<_>.OneRelaxed * 0.4f + Stats<_>.OneEnjoyed * 0.8f, 
                        Stats<_>.OneRested * 0.01f + Stats<_>.OneFit * 0.001f + Stats<_>.OneSated * 0.01f, [], 7200.0f<s>)
      with MoneyLost = 20.0f<eur>
    }
  {
    ItemDescription.Name  = "Cinema-screen"
    UseEffects      = [use_effects]
    UseSlots        = UseSlot.HourRange(16,23)
    OpenUse         = true
  }
let ticket_counter = 
  let use_effects = 
    {
      UseEffects.Create("Selling tickets", Stats.Zero,
                        Stats<_>.OneRested * 0.2f + Stats<_>.OneFit * 0.004f + Stats<_>.OneEnjoyed * 0.2f +
                        Stats<_>.OneSated * 0.04f + Stats<_>.OneRelaxed * 0.2f, 14400.0f<s>)
      with MoneyGained = 35.0f<eur>
    }
  {
    ItemDescription.Name  = "Counter"
    UseEffects      = [use_effects]
    UseSlots        = UseSlot.HourRange(16,23)
    OpenUse         = false
  }

let exposed_groceries = 
  let fridge_groceries = 
    {
      ItemDescription.Name  = "Groceries"
      UseEffects      = []
      UseSlots        = UseSlot.AllDay
      OpenUse         = true
    }
  let use_effects = 
    {
      UseEffects.Create("Buy", Stats<_>.Zero, 
                                Stats<_>.OneRested * 0.01f + Stats<_>.OneFit * 0.001f + Stats<_>.OneSated * 0.01f, [], 1800.0f<s>)
      with MoneyLost = 10.0f<eur>
           ItemsGained = [for i = 1 to 10 do yield ref fridge_groceries]
    }
  {
    ItemDescription.Name  = "Groceries"
    UseEffects      = [use_effects]
    UseSlots        = UseSlot.HourRange(8,21)
    OpenUse         = true
  }
let groceries_counter = 
  let use_effects = 
    {
      UseEffects.Create("Selling groceries", Stats.Zero,
                        Stats<_>.OneRested * 0.2f + Stats<_>.OneFit * 0.004f + Stats<_>.OneEnjoyed * 0.2f +
                        Stats<_>.OneSated * 0.04f + Stats<_>.OneRelaxed * 0.2f, 14400.0f<s>)
      with MoneyGained = 35.0f<eur>
    }
  {
    ItemDescription.Name  = "Counter"
    UseEffects      = [use_effects]
    UseSlots        = UseSlot.HourRange(7,22)
    OpenUse         = false
  }


  //----RG------// 
//Le Hospitalle
let hospital_work = 
  let use_effects = 
    {
      UseEffects.Create("Helping patients", Stats.Zero, 
                        Stats<_>.OneRested * 0.2f + Stats<_>.OneFit * 0.004f + Stats<_>.OneEnjoyed * 0.01f +
                        Stats<_>.OneSated * 0.04f + Stats<_>.OneRelaxed * 0.2f, 14400.0f<s>)
      with MoneyGained = 65.0f<eur>
    }
  {
    ItemDescription.Name  = "Operation Table"
    UseEffects      = [use_effects]
    UseSlots        = UseSlot.HourRange(8,17)
    OpenUse         = false
  }


///Zhe SCHOOL
let school_work = 
  let use_effects = 
    {
          UseEffects.Create("Teaching students", Stats.Zero, 
                            Stats<_>.OneRested * 0.2f + Stats<_>.OneFit * 0.004f + Stats<_>.OneEnjoyed * 0.01f +
                            Stats<_>.OneSated * 0.04f + Stats<_>.OneRelaxed * 0.2f, 14400.0f<s>)
          with MoneyGained = 45.0f<eur>
    }
  {
    ItemDescription.Name  = "Teachers Desk"
    UseEffects      = [use_effects]
    UseSlots        = UseSlot.HourRange(8,17)
    OpenUse         = false
  }

//The PUB :D :D :D :D
let pub_barchair = 
  let use_effects = 
    {
      UseEffects.Create("Go Out", Stats<_>.OneSated * 0.05f + Stats<_>.OneEnjoyed * 0.3f,
                        Stats<_>.OneRested * 0.01f + Stats<_>.OneFit * 0.1f, 3600.0f<s>)
        with MoneyLost = 5.0f<eur>
    }
  {
    ItemDescription.Name  = "Pub Chair"
    UseEffects      = [use_effects]
    UseSlots        = UseSlot.HourRange(18,3)
    OpenUse         = true
  }
let pub_barcounter = 
  let use_effects = 
    {
      UseEffects.Create("Serve Drinks", Stats.Zero,
                        Stats<_>.OneRested * 0.2f + Stats<_>.OneFit * 0.004f + Stats<_>.OneEnjoyed * 0.2f +
                        Stats<_>.OneSated * 0.04f + Stats<_>.OneRelaxed * 0.2f, 14400.0f<s>)
      with MoneyGained = 35.0f<eur>
    }
  {
    ItemDescription.Name  = "Pub Bar"
    UseEffects      = [use_effects]
    UseSlots        = UseSlot.HourRange(17,4)
    OpenUse         = false
  }